package easy

func FindLHS(nums []int) int {
	freq := map[int]int{}
	for _, num := range nums {
		freq[num]++
	}
	count := 0
	for key, value := range freq {
		if freq[key+1] > 0 {
			count = max(count, freq[key+1]+value)
		}
	}
	return count
}
